package com.yanyu.space.sys.listener.rocket;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;


/**
 * @author gz
 */
@Slf4j
@Service
public class ProductNewBinder {

    @Autowired
    private StreamBridge streamBridge;

    @MessageMapping
    public String send() {
        Map<String, String> map = new HashMap<String, String>() {
            {
                put("gt", "tttt");
            }
        };
        streamBridge.send("spaceproductera-out-0", MessageBuilder.withPayload(map).build());
        log.info("发送消息: space-productera");
        return "test";
    }
}
